<%@ page contentType="text/html;charset=UTF-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<%@ taglib prefix="tags" tagdir="/WEB-INF/tags"%>
<c:set var="ctx" value="${pageContext.request.contextPath}" />
<html>
<head>
<title>${attachInfo.title}:附件列表</title>
<script type="text/javascript">
	var grid;//注意：此名字已约定，不要更改
	$(function() {
		grid = $("#grid").datagrid({
			title : "${attachInfo.title}",
			fitColumns : true,
			toolbar : "#toolbar",
			method : "get",
			singleSelect : true,
			pagination : true,
			url : "${ctx}/basic/attachment/dataGrid/${attachInfo.masterId}"
		});
		
		$('#file_upload').uploadify({
	        'swf'      : '${ctx}/static/uploadify/uploadify.swf',
	        'uploader' : '${ctx}/basic/attachment/busUpload/${attachInfo.masterId}',
	        'buttonText':'附件上传', 
	        'width':100,
	        'height':20,
	         onUploadSuccess : function(file, data, response) {
	        	var data = eval('(' + data + ')');
	        	if(data.success){
	        		grid.datagrid("reload");
	        	}
	        	showInfo(data.msg);
	        }
	    });
	});
</script>
</head>
<body>
	<div data-options="region:'center',border:false,fit:true">
		<table id="grid" data-options="fit:true">
			<thead>
				<tr>
					<th field="id" hidden="true"></th>
					<th field="fileName" width="160">文件名称</th>
					<th field="fileSize" width="60">大小</th>
					<th field="uploadTime" width="60">上传时间</th>
					<th field="operate" width="60" formatter="fmt_attach">操作</th>
				</tr>
			</thead>
		</table>
		<div id="toolbar">
				<input type="button" value="返回" onClick="javascript: history.go(-1)">
		</div>
	</div>
	<div data-options="region:'south'" style="height:150px">
		<div class="easyui-panel" title="附件上传" fit="true">
			<input type="file" name="file_upload" id="file_upload" />
		</div>
	</div>
</body>
</html>
